package unimelb.discussiontracker.twitter.data.dao.impl;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import unimelb.discussiontracker.twitter.data.dao.IIntervalDao;
import unimelb.discussiontracker.twitter.data.entity.IntervalEntity;

@Repository
public class IntervalDao extends GenericDataAccessObject<IntervalEntity> implements IIntervalDao {

    @Override
    public List<IntervalEntity> findAll() {
        return this.runNamedQuery("Interval.FindAll", null, null);
    }

    @Override
    public IntervalEntity findByStartEnd(Date start, Date end) {
        final Map<String, Object> queryParams = new HashMap<String, Object>();
        queryParams.put("start", start);
        queryParams.put("end", end);
        return this.runSingleResultNamedQuery("Interval.FindByStartEnd", queryParams, null);
    }

}
